from django.db import models

# 请不要随意修改以下模型，生成的表结构会影响评测

from django.db import models
from django.contrib.auth.models import User


class Article(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    category = models.CharField("文章分类", max_length=100, null=True)
    title = models.CharField("文章标题", max_length=100)
    author = models.CharField("作者", max_length=50)
    abstract = models.CharField("摘要", max_length=100, null=True)
    content = models.TextField("文章内容")
    c_time = models.DateTimeField("创建日期", null=True)
    like_num = models.IntegerField("点赞数", null=True)
    reply_num = models.IntegerField("回复数", null=True)
    read_num = models.IntegerField("阅读数", null=True)
    against_num = models.IntegerField("反对数", null=True)

    class Meta:
        verbose_name = "文章"


class CommentInfo(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    article = models.ForeignKey(Article, on_delete=models.CASCADE)
    c_time = models.DateTimeField("创建日期")
    content = models.TextField("文章内容")

    class Meta:
        verbose_name = "文章评论"


class LogInfo(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    article = models.ForeignKey(Article, on_delete=models.CASCADE)
    types = models.IntegerField("分类", null=True)
    c_time = models.DateTimeField("创建日期", auto_now_add=True)

    class Meta:
        verbose_name = "点评信息"
